package com.wanbangee.marksystem.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wanbangee.marksystem.entities.MAnswerSheetRecord;
import com.wanbangee.marksystem.entities.MExamMarker;
import com.wanbangee.marksystem.service.IExamInfoService;

/**
 * 
 * 考试任务列表信息（阅卷任务、重评任务、仲裁任务）
 * @author 小粥愚
 *
 */
@RestController
public class ExamInfoController {
	
	@Autowired
	private IExamInfoService examInfoService;//考试信息service类
	
	//
	/**
	 * 显示问题卷题目信息(指定某题)
	 * @param recordId 记录表id
	 * @return
	 */
	@GetMapping("/exam-score/setting/examProblemTestInfo")
	public Map<String,Object> examProblemTestInfo(Integer recordId){
		MAnswerSheetRecord examPromTestInfo = this.examInfoService.selectProblemTestExamInfoByRecordId(recordId);
		Map<String,Object> map = new HashMap<>();
		map.put("code", 1001);
		map.put("msg", "查询成功");
		map.put("examPromInfoList", examPromTestInfo);
		return map;
	}
	
	/**
	 * 显示问题卷列表信息(学科负责人管理)
	 * @param teaId
	 * @param schId
	 * @param recordType 查询类别————未处理：1,已处理：4
	 * @return
	 */
	@GetMapping("/exam-score/setting/examProblemInfo")
	public Map<String,Object> examProblemInfo(Integer teaId,Integer schId,Integer recordType){
		System.out.println("examInfo"+teaId+"---"+schId);
		List<MAnswerSheetRecord> examPromInfoList = this.examInfoService.selectProblemExamInfoByTeaIdAndSchId(teaId, schId,recordType);
		Map<String,Object> map = new HashMap<>();
		map.put("code", 1001);
		map.put("msg", "查询成功");
		map.put("examPromInfoList", examPromInfoList);
		return map;
	}
	
	/**
	 * 显示仲裁列表信息
	 * @param teaId
	 * @param schId
	 * @return
	 */
	@GetMapping("/exam-score/setting/examArbitrationInfo")
	public Map<String,Object> examArbitrationInfo(Integer teaId,Integer schId){
		System.out.println("examInfo"+teaId+"---"+schId);
		List<MExamMarker> examArbInfoList = this.examInfoService.selectArbitrationExamInfoByTeaIdAndSchId(teaId, schId);
		Map<String,Object> map = new HashMap<>();
		map.put("code", 1001);
		map.put("msg", "查询成功");
		map.put("examArbInfoList", examArbInfoList);
		return map;
	}
	
	/**
	 * 显示阅卷列表信息
	 * @param teaId
	 * @param schId
	 * @return
	 */
	@GetMapping("/exam-score/setting/examInfo")
	public Map<String,Object> examInfo(Integer teaId,Integer schId){
		System.out.println("examInfo"+teaId+"---"+schId);
		List<MExamMarker> examInfoList = this.examInfoService.selectExamInfoByExamIdAndTopicNo(teaId, schId);
		Map<String,Object> map = new HashMap<>();
		map.put("code", 1001);
		map.put("msg", "查询成功");
		map.put("examInfoList", examInfoList);
		return map;
	}
	
	/**
	 * 根据recordId，修改问题卷类型（修改为已处理问题卷）	(测试结果:✔)
	 * @param recordId
	 * @return
	 */
	@GetMapping("/exam-score/setting/updateProblemTestInfo")
	public Integer updateProblemTestInfo(Integer recordId) {
		return this.examInfoService.updateProblemTestInfoByRecordId(recordId);
	}

}
